package com.studio49.exmple.controller.appInterface.appProduct;

import java.util.Date;

import com.studio49.exmple.common.util.PubDateUtils;
import com.studio49.exmple.core.controller.AppBaseController;
import com.studio49.exmple.core.entity.pub.JsonResult;
import com.studio49.exmple.entity.appInterface.ReqEntity;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.studio49.exmple.service.appInterface.AppProductService;

@Controller
@RequestMapping("/appInterface/appProduct")
public class AppProductController extends AppBaseController {

	private static final Logger LOG = LogManager.getLogger(AppProductController.class.getName());
	
	@Autowired
	private AppProductService appProductService;
	
	/**
	 * 查询公告
	 * 
	 * @param page
	 * @param pageSize
	 * @return
	 */
	@RequestMapping(value = "/findAppNoticeListByPage", method = RequestMethod.POST)
	@ResponseBody
	public JsonResult findAppNoticeListByPage(ReqEntity reqEntity, Integer pageNum, Integer pageSize) {
		LOG.warn("findAppNoticeListByPage start ... " + PubDateUtils.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss:SSS"));
		LOG.warn("reqData: " + JSON.toJSONString(reqEntity) + "page=" + pageNum + "pageSize=" + pageSize);
		JsonResult jsonResult = new JsonResult(true);
		try {
			jsonResult = appProductService.findAppNoticeListByPage(pageNum, pageSize);
		} catch (Exception e) {
			super.setErrMsg("服务器异常!", LOG, jsonResult, e);
		}
		LOG.warn("resData: " + JSON.toJSONString(jsonResult));
		LOG.warn("findAppNoticeListByPage end ... " + PubDateUtils.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss:SSS"));
		return jsonResult;
	}
	
}
